<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE>
<html>
<head>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/css/detail.css">
</head>
<body> 
<div class="basic">
	<h1>用户管理</h1>
	<form id="query" class="form-inline">
		<div class="form-group">
	      <input type="text" class="form-control" name="id" placeholder="请输入id">
	   	</div>
	   	<button type="button" onclick="queryUser('${pageContext.request.contextPath }/back/user/queryById')" class="btn btn-primary">查询</button>
	</form>
	<div class="manage">
		<span>用户列表</span>
		<span>
			<button type="button" onclick="loadPage('${pageContext.request.contextPath }/back/user/addUserForm')" class="btn btn-primary">添加用户</button>
		</span>
	</div>
	<table id="users" class="table table-striped">
		<thead>
		<tr>
			<td>用户编号</td>
			<td>电话号</td>
			<td>密码</td>
			<td>余额</td>
			<td>真实姓名</td>
			<td>身份证号</td>
			<td>职业</td>	
			<td>注册时间</td>    
			<td>编辑</td>	
		</tr>
		</thead>
		<tbody>
		<c:forEach items="${usersList }" var="user">
			<tr>
				<td>${user.userid }</td> <%--这里必须要是 .属性名 --%>
				<td>${user.utel }</td>
				<td>${user.upassword }</td>
				<td>${user.umoney }</td>
				<td>${user.urealname }</td>
				<td>${user.uidentification }</td>
				<td>${user.uoccupation }</td>
	  			<td>
	  				<fmt:formatDate value="${user.uregtime }" pattern="yyyy-MM-dd  HH:mm:ss" />
	  			</td>  
				<td>
					<a href="javascript:getUser('${pageContext.request.contextPath }/back/user/queryById?id=${user.userid }')">修改</a>
					<a href="javascript:deleteUser('${pageContext.request.contextPath }/back/user/deleteUser?id=${user.userid}')">删除</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
</div>

<div class="modal fade" id="changeMsg" tabindex="-1" role="dialog" 
   aria-labelledby="myModalLabel" aria-hidden="true">
   <div class="modal-dialog">
      <div class="modal-content">
         <div class="modal-header">
            <button type="button" class="close" 
               data-dismiss="modal" aria-hidden="true">
                  &times;
            </button>
            <h4 class="modal-title" id="myModalLabel">修改用户信息</h4>
         </div>
         <div class="modal-body">
         	<form id="changeForm">
         		<div class="form-group">
			      <label for="firstname" class="col-sm-2 control-label">电话号码</label>
			      <div class="col-sm-10">
			         <input type="text" class="form-control" name="utel" placeholder="请输入电话号码">
			      </div>
			   	</div>
			   	<div class="form-group">
			      <label for="lastname" class="col-sm-2 control-label">密码</label>
			      <div class="col-sm-10">
			         <input type="text" class="form-control" name="upassword" placeholder="请输入密码">
			      </div>
			   	</div>
			   	<div class="form-group">
			      <label for="lastname" class="col-sm-2 control-label">余额</label>
			      <div class="col-sm-10">
			         <input type="text" class="form-control" name="umoney" placeholder="请输入余额">
			      </div>
			   	</div>
			   	<div class="form-group">
			      <label for="lastname" class="col-sm-2 control-label">真实姓名</label>
			      <div class="col-sm-10">
			         <input type="text" class="form-control" name="urealname" placeholder="请输入真实姓名">
			      </div>
			   	</div>
			   	<div class="form-group">
			      <label for="lastname" class="col-sm-2 control-label">身份证号码</label>
			      <div class="col-sm-10">
			         <input type="text" class="form-control" name="uidentification" placeholder="请输入身份证号码">
			      </div>
			   	</div>
			   	<div class="form-group">
			      <label for="lastname" class="col-sm-2 control-label">职业</label>
			      <div class="col-sm-10">
			         <input type="text" class="form-control" name="uoccupation" placeholder="请输入职业">
			      </div>
			   	</div>
			   	<input class="hidden" name="userid">
         	</form>
         </div>
         <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            <button type="button" onclick="updateUser('${pageContext.request.contextPath}/back/user/editUserSubmit')" class="btn btn-primary">提交更改</button>
         </div>
      </div><!-- /.modal-content -->
	</div><!-- /.modal -->
</div>

</body>

</html>